package com.geekhole.demo.user.application.v2.application;

import com.geekhole.demo.user.application.UserApplication;
import com.geekhole.demo.user.domain.CreateAndEnableUserContext;
import com.geekhole.demo.user.domain.ModifyUserNameContext;
import com.geekhole.demo.user.application.v2.service.CreateAndEnableUserService;
import com.geekhole.demo.user.application.v2.service.ModifyUserNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserV2Application implements UserApplication {
    @Autowired
    private CreateAndEnableUserService createAndEnableUserService;

    @Autowired
    private ModifyUserNameService modifyUserNameService;

    @Override
    public void createAndEnableUser(CreateAndEnableUserContext context) {
        // 将逻辑分发给领域服务
        this.createAndEnableUserService.handle(context);
    }

    @Override
    public void modifyUserName(ModifyUserNameContext context) {
        // 将逻辑分发给领域服务
        this.modifyUserNameService.handle(context);
    }
}
